home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C20 / VectorOverflow.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  709 b   |  27 lines

  1. //: C20:VectorOverflow.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Shows the copy-construction and destruction
  7. // That occurs when a vector must reallocate
  8. // (It maintains a linear array of elements)
  9. #include "Noisy.h"
  10. #include "../require.h"
  11. #include <vector>
  12. #include <iostream>
  13. #include <string>
  14. #include <cstdlib>
  15. using namespace std;
  16.  
  17. int main(int argc, char* argv[]) {
  18.   requireArgs(argc, 1);
  19.   int size = 1000;
  20.   if(argc >= 2) size = atoi(argv[1]);
  21.   vector<Noisy> vn;
  22.   Noisy n;
  23.   for(int i = 0; i < size; i++)
  24.     vn.push_back(n);
  25.   cout << "\n cleaning up \n";
  26. } ///:~
  27.